package com.hxzy.module.auth.api.auth;

import com.hxzy.framework.common.req.CaptchaCodeReq;
import com.hxzy.framework.common.resp.CaptchaCodeResp;
import com.hxzy.framework.common.resp.R;
import com.hxzy.module.auth.api.auth.resp.Oauth2TokenDto;
import com.hxzy.module.auth.api.enums.ApiConstants;
import com.hxzy.module.auth.api.fallback.AuthFeignApiFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @Author wy
 * @Description auth统一认证远程服务
 * @Date 2024/1/26 16:11
 * @Version 1.0
 */
@FeignClient(name = ApiConstants.SERVER_NAME,fallbackFactory = AuthFeignApiFallbackFactory.class)
public interface AuthFeignApi {

    /**
     * oauth2登录授权
     * @param parameters
     * @return
     */
    @PostMapping(value = "/oauth/token")
    R<Oauth2TokenDto> postAccessToken(@RequestParam Map<String, String> parameters);

    /**
     * 获取商户RSA
     * @return
     */
    @GetMapping(value = "/rsa/publicKey")
    Map<String, Object> getKey();


    /**
     * 获取图形验证码(Easy-Captcha框架)
     * @param req
     * @return
     */
    @GetMapping(value = "/easy/captcha")
    R<CaptchaCodeResp> easyCaptcha(@SpringQueryMap CaptchaCodeReq req);


}
